const { Tool, API, Event, Storage} = global.$util
Page({
  data: {
    phone: '',
    shopId: ''
  },
  onLoad: function (options) {
    this.setData({
      shopId: options.shopId
    })
  },
  //下一步
  submit() {
    if (Tool.isEmptyStr(this.data.phone)){
      Tool.showToast("用户手机号不能为空");
      return
    }
    if (!Tool.checkPhone(this.data.phone)) {
      Tool.showToast("请输入正确的手机号");
      return
    }
    let params = {
      id: this.data.shopId,
      mobile: this.data.phone,
    }
    API.addClerk(params).then((res) => {
      Tool.navigationPop()
    }).catch((res) => {
      console.error(res)
    })
  },
  inpPhone(e) {
    this.setData({
      phone: e.detail.value
    })
},
})
